﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using ZEBuz.Questionnaire.Lib.Core;

namespace ZEBuz.Questionnaire.Web.Admin
{
    public partial class process : AdminBasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                FillData();
            }
        }

        private void FillData()
        {
            DataTable dt = Questionnaire.Lib.Entities.QuestionnaireUser.List(1, 1);
            this.main.DataSource = dt;
            this.main.DataBind();
        }

        protected void main_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.AlternatingItem ||
             e.Item.ItemType == ListItemType.Item ||
             e.Item.ItemType == ListItemType.SelectedItem)
            {
                Label lblAnswerDate = e.Item.FindControl("lblAnswerDate") as Label;
                DataRowView drv = e.Item.DataItem as DataRowView;
                lblAnswerDate.Text = drv["insertdt"] == DBNull.Value ? string.Empty : drv["insertdt"].ToString();
                HyperLink link = e.Item.FindControl("link") as HyperLink;
                link.NavigateUrl = "view.aspx?seqno=" + drv["SEQNO"].ToString();
            }
        }
    }
}